package model

import (
	"fmt"
	"github.com/astaxie/beego/orm"
	_ "github.com/go-sql-driver/mysql"
)

type Users struct {
	Id         int64 `orm:"auto"`
	Username   string
	Password   string
	Mobile     string
	Email      string
	UpdateTime string
	CreateTime string
}

type Goods struct {
	Id     int64 `orm:"auto"`
	Name   string
	Price  float64
	Num    int64
	Status string
	Img    string
	Desc   string
}

type Order struct {
	OrderNum    int64 `orm:"auto"`
	UserName    string
	GoodId      int64
	Count       int64
	TotalAmount float64
	CreateTime  string
	Address     string
}

func init() {
	fmt.Println(Order{})
	orm.RegisterDriver("mysql", orm.DRMySQL)
	orm.RegisterDataBase("default", "mysql", "root:root@tcp(127.0.0.1:3306)/user")
	orm.RegisterModel(new(Users), new(Goods), new(Order))
	orm.RunSyncdb("default", false, true)
	orm.Debug = true
}
